import 'package:base_lib/common/base/base_theme_widget.dart';
import 'package:base_lib/index.dart';
import 'package:base_lib/theme/theme_global.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:photo_view/photo_view.dart';

import '../component.dart';

///查看处方笺大图
class ViewRpImgPage extends BaseThemeWidget {
  final String url;

  ViewRpImgPage(this.url);

  @override
  Widget buildChild(BuildContext context, MTheme theme) {
    return Scaffold(
        backgroundColor: theme.themeColor.themeBgColor,
        appBar: AppBar(
          leading: BackButton(
            onPressed: () {
              Routers.pop(context);
            },
          ),
          centerTitle: true,
          title: Text('处方笺'),
        ),
        body: Container(
          child: PhotoView(
            imageProvider: url.contains('http://') || url.contains("https://")
                ? NetworkImage(url)
                : AssetImage(
                    'packages/${DoctorOrderComponent.AssetPackageName}/images/rpFileStampFileUrl.png'),
          ),
        ));
  }
}
